Hey there, Welcome to another blog post! Today we’re picking off where we stopped in the last post. I’ll be discussing more about Git and Version Control.

Git
Git is a software that allows you to keep track of changes made to a project over time. Git works by recording the changes you make to a project, storing those changes, then allowing you to reference them as needed. A Git project can be thought of as having three parts:

  • A Working Directory. This is where you’ll be doing all the work; creating, editing, deleting and organizing files.
  • A Staging Area. This is where you prepare the set of changes you made before finalizing them as a commit in the Repository
  • A Repository. This is where Git permanently stores those changes as different versions of the project.

The Git workflow consists of editing files in the working directory, adding files to the staging area and saving the changes to Git repository.

Version Control Systems (VCS)
A version control system records changes to a file or set of files over time, enabling the retrieval of specific versions later. This provides several key benefits:

  • History Tracking: A complete history of all changes made to a project is maintained, including who made the change, when it was made, and what the change entailed.
  • Collaboration: Multiple individuals can work on the same project simultaneously without overwriting each other's work. VCS facilitates merging changes from different contributors into a unified codebase.
  • Branching and Merging: VCS allows the creation of branches, which are separate lines of development. This enables experimentation and feature development without affecting the main codebase. Changes from branches can be merged back into the main codebase when ready.
  • Reversion: The ability to revert to previous versions of files or the entire project if errors are introduced or unwanted changes occur.

Git as a Distributed VCS
Git distinguishes itself as a distributed version control system, meaning that each developer has a complete copy of the entire repository, including its full history, on their local machine. Like I said in the last post, Git can also be used outside of GitHub. This offers advantages over centralized systems:

  • Offline Work: Developers can work on their local repositories without an internet connection and synchronize their changes later.
  • Redundancy: The distributed nature provides inherent backup, as multiple copies of the repository exist.
  • Speed: Operations like committing and viewing history are often faster as they occur locally.
  • Flexibility: Developers can experiment with changes in isolated branches without affecting the main codebase until they are ready to merge.

Key Git Concepts

  • Commit: A snapshot of the project at a specific point in time, along with a message describing the changes.
  • Branch: A separate line of development that diverges from the main project and allows for parallel work on different features or fixes.
  • Merge: The process of combining changes from one branch into the main project.

Conclusion
In summary, Git is a robust & flexible tool for managing changes to projects, and its distributed nature offers significant advantages for collaboration and flexibility. Understanding these concepts is essential for effective use of Git in software development.

Thank you for reading and have a wonderful rest of your day.👋